This notebook contains exploratory analyses of behavioral data collected to investigate the relationship between risk taking behavior and probabilistic learning.
The sample consists of three age groups: kids, teens and adults and we hypothesize that sensitivity to learn from high variance feedback improves with age (and this is related to better risky decisions).
Subjects completed a probabilistic learning task in the scanner, a risky decision making task (BART) outside the scanner and numerous questionnaires. The focus of this notebook is on the first task.
The plan of analysis is to establish that adults are more sensitive to high variance feedback in the probabilistic learning task and relate this (modeled) sensitivity to behavior both in BART and other self-reported risky behaviors. Details of correlations are found here
First let’s get a sense of the sample. Here is how many subjects we have who have complete datasets for the probabilistic learning task and their age break downs.
machine_game_data_clean %>%
group_by(age_group) %>%
summarise(min_age = min(calc_age),
mean_age = mean(calc_age),
sd_age = sd(calc_age),
max_age = max(calc_age),
n = n()/180)
This task is a modified Iowa Gambling Task. Subjects are presented with a fractal in each trial. The fractals represent different machines (single-armed bandits). Subjects choose to play or pass in each trial. Each machine yields a probabilistic reward. There are four machines in total. Two with positive and two with negative expected value. One of each of these machines has a low variance reward schedule while the other has a high variance reward schedule.
Performance in this task can be assessed by looking at the total number of points subjects make at the end of task. The following graph shows that adults collect more points in this task compared to kids.
machine_game_data_clean %>%
group_by(Sub_id, facet_labels) %>%
summarise(total_points = sum(Points_earned)) %>%
do(assign.age.info(.)) %>%
group_by(age_group) %>%
summarise(mean_points = mean(total_points),
sem_points = sem(total_points)) %>%
ggplot(aes(age_group, mean_points))+
geom_bar(stat='identity', position = position_dodge((0.9)))+
geom_errorbar(aes(ymin=mean_points-sem_points, ymax=mean_points+sem_points), position = position_dodge(0.9), width=0.25)+
theme_bw()+
xlab('Machine')+
ylab('Mean points')+
labs(fill='Age group')
This difference is statistically significant: adults earn more points compared to the kids.
tmp = machine_game_data_clean %>%
group_by(Sub_id) %>%
summarise(total_points = sum(Points_earned)) %>%
do(assign.age.info(.))
summary(lm(total_points~age_group, data=tmp))
Call:
lm(formula = total_points ~ age_group, data = tmp)
Residuals:
Min 1Q Median 3Q Max
-2826.4 -975.1 -220.0 1134.7 2416.5
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 277.6 249.8 1.111 0.27029
age_groupteen 525.9 411.0 1.280 0.20480
age_groupadult 978.8 356.5 2.746 0.00764 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1345 on 71 degrees of freedom
Multiple R-squared: 0.09618, Adjusted R-squared: 0.07072
F-statistic: 3.778 on 2 and 71 DF, p-value: 0.0276
Since we are interested in the age differences between sensitivity to different feedback schedules, we should show that this difference in performance exists especially for the high variance feedback condition(s). Here is the plot of performance (total points earned) broken down by conditions.
machine_game_data_clean %>%
group_by(Sub_id, facet_labels) %>%
summarise(total_points = sum(Points_earned)) %>%
do(assign.age.info(.)) %>%
group_by(age_group, facet_labels) %>%
summarise(mean_points = mean(total_points),
sem_points = sem(total_points)) %>%
ggplot(aes(facet_labels, mean_points, fill=age_group))+
geom_bar(stat='identity', position = position_dodge((0.9)))+
geom_errorbar(aes(ymin=mean_points-sem_points, ymax=mean_points+sem_points), position = position_dodge(0.9), width=0.25)+
# theme_bw()+
xlab('Machine')+
ylab('Mean points')+
labs(fill='Age group')
ggsave("Points_earned.jpeg", device = "jpeg", path = fig_path, width = 7, height = 5, units = "in", dpi = 450)
Running separate models for positive and negative EV machines for ease of interpretation.
tmp <- machine_game_data_clean %>%
group_by(Sub_id, facet_labels) %>%
summarise(total_points = sum(Points_earned)) %>%
do(assign.age.info(.))
In the positive EV machines there is a main effect for the high variance machine. Subjects earn fewer points in the high variance condition compared to the low variance condition. There are no age differences.
summary(lm(total_points ~ age_group*facet_labels, data = tmp %>% filter(facet_labels %in% c("-10,+100", "-5,+495"))))
Call:
lm(formula = total_points ~ age_group * facet_labels, data = tmp %>%
filter(facet_labels %in% c("-10,+100", "-5,+495")))
Residuals:
Min 1Q Median 3Q Max
-1320.00 -354.12 80.89 436.25 975.00
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1475.17 89.35 16.510 <2e-16
age_groupteen 208.95 146.98 1.422 0.1573
age_groupadult 218.04 127.49 1.710 0.0894
facet_labels-5,+495 -293.62 126.36 -2.324 0.0216
age_groupteen:facet_labels-5,+495 -40.50 207.86 -0.195 0.8458
age_groupadult:facet_labels-5,+495 -99.59 180.29 -0.552 0.5815
(Intercept) ***
age_groupteen
age_groupadult .
facet_labels-5,+495 *
age_groupteen:facet_labels-5,+495
age_groupadult:facet_labels-5,+495
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 481.2 on 142 degrees of freedom
Multiple R-squared: 0.1425, Adjusted R-squared: 0.1123
F-statistic: 4.72 on 5 and 142 DF, p-value: 0.0005098
In the negative EV machines there is again a main effect for the high variance machine: Everyone losses fewer points in the low variance condition. There is also a main effect for adults: Adults perform better than kids for both negative EV machines.
summary(lm(total_points ~ age_group*facet_labels, data = tmp %>% filter(facet_labels %in% c("+10,-100", "+5,-495"))))
Call:
lm(formula = total_points ~ age_group * facet_labels, data = tmp %>%
filter(facet_labels %in% c("+10,-100", "+5,-495")))
Residuals:
Min 1Q Median 3Q Max
-1236.21 -389.66 28.79 393.93 1000.34
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -953.79 89.90 -10.610 < 2e-16
age_groupteen 59.68 147.88 0.404 0.687150
age_groupadult 292.36 128.26 2.279 0.024133
facet_labels+5,-495 -471.55 127.13 -3.709 0.000298
age_groupteen:facet_labels+5,-495 29.20 209.13 0.140 0.889157
age_groupadult:facet_labels+5,-495 57.62 181.39 0.318 0.751199
(Intercept) ***
age_groupteen
age_groupadult *
facet_labels+5,-495 ***
age_groupteen:facet_labels+5,-495
age_groupadult:facet_labels+5,-495
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 484.1 on 142 degrees of freedom
Multiple R-squared: 0.2382, Adjusted R-squared: 0.2114
F-statistic: 8.882 on 5 and 142 DF, p-value: 2.333e-07
So the age diffence in performance is driven by difference in performance in negative EV machines. The question is what difference in behavior in these conditions is leading to this difference in performance?
To anticipate possible cognitive processes that will be parameterized in RL models differences can lie in: how quickly the groups learn the probabilities, how much weight they put on the outcomes and/or how much like an optimal agent they behave.
The first thing we can look at is how often subjects play versus pass. It’s hard to see any age differences when we just look at frequency of overall playing as below.
machine_game_data_clean %>%
group_by(Sub_id, Response) %>%
tally %>%
group_by(Sub_id) %>%
mutate(pct=(100*n)/sum(n)) %>%
do(assign.age.info(.)) %>%
group_by(age_group, Response) %>%
dplyr::summarise(mean_pct = mean(pct),
sem_pct = sem(pct)) %>%
ggplot(aes(Response, mean_pct, fill = age_group))+
geom_bar(stat='identity', position = position_dodge(0.9))+
geom_errorbar(aes(ymin = mean_pct - sem_pct, ymax = mean_pct + sem_pct), position = position_dodge(width = 0.9), width=0.25)+
theme_bw()+
ylab('Percentage of trials')+
labs(fill = 'Age group')
It is also not immediately apparent how to translate this to better performance/learning in this task but one way to think about it: If people learned perfectly they should play half of the time (always for the positive expected value trial and never for the negative expected value trials). The fact that all play proportions are above 50% suggests that nobody learns perfectly and that adults might be closest to it. But this is very crude and a better way to look at it would be to see
To get a better sense of overall behavior in different contingency states we break this proportion of playing down by machines.
Now we can see age differences in playing frequency in different conditions, particularly in the negative expected value machines (bottom row).
machine_game_data_clean %>%
group_by(Sub_id, facet_labels, Response) %>%
tally %>%
group_by(Sub_id, facet_labels) %>%
mutate(pct=(100*n)/sum(n)) %>%
do(assign.age.info(.)) %>%
group_by(age_group, facet_labels, Response) %>%
summarise(mean_pct = mean(pct),
sem_pct = sem(pct)) %>%
ggplot(aes(Response, mean_pct, fill = age_group))+
geom_bar(stat='identity', position = position_dodge(0.9))+
geom_errorbar(aes(ymin = mean_pct - sem_pct, ymax = mean_pct + sem_pct), position = position_dodge(width = 0.9), width=0.25)+
ylab('Percentage of trials')+
facet_wrap(~facet_labels)+
labs(fill = 'Age group')
ggsave("Prop_played.jpeg", device = "jpeg", path = fig_path, width = 8, height = 5, units = "in", dpi = 450)
The differences in points earned map directly on to proportion of choosing to play each machine:
tmp <- machine_game_data_clean %>%
group_by(Sub_id, facet_labels, Response) %>%
tally %>%
group_by(Sub_id, facet_labels) %>%
mutate(pct_play=(100*n)/sum(n)) %>%
filter(Response == 'play') %>%
do(assign.age.info(.))
summary(lmer(pct_play ~ age_group*facet_labels + (1|Sub_id), data = tmp))
Linear mixed model fit by REML ['lmerMod']
Formula: pct_play ~ age_group * facet_labels + (1 | Sub_id)
Data: tmp
REML criterion at convergence: 2610.1
Scaled residuals:
Min 1Q Median 3Q Max
-2.63748 -0.72488 0.04741 0.75053 1.95807
Random effects:
Groups Name Variance Std.Dev.
Sub_id (Intercept) 51.5 7.176
Residual 457.4 21.386
Number of obs: 296, groups: Sub_id, 74
Fixed effects:
Estimate Std. Error t value
(Intercept) 74.2529 4.1889 17.726
age_groupteen 10.1916 6.8906 1.479
age_groupadult 9.5567 5.9767 1.599
facet_labels-5,+495 -17.0115 5.6163 -3.029
facet_labels+10,-100 -28.2759 5.6163 -5.035
facet_labels+5,-495 -10.4215 5.6163 -1.856
age_groupteen:facet_labels-5,+495 -0.7663 9.2385 -0.083
age_groupadult:facet_labels-5,+495 -1.7187 8.0132 -0.214
age_groupteen:facet_labels+10,-100 -13.2928 9.2385 -1.439
age_groupadult:facet_labels+10,-100 -23.5495 8.0132 -2.939
age_groupteen:facet_labels+5,-495 -14.4151 9.2385 -1.560
age_groupadult:facet_labels+5,-495 -27.5151 8.0132 -3.434
Correlation of Fixed Effects:
(Intr) ag_grpt ag_grpd f_-5,+ f_+10, f_+5,-
age_grouptn -0.608
age_gropdlt -0.701 0.426
fct_-5,+495 -0.670 0.408 0.470
fc_+10,-100 -0.670 0.408 0.470 0.500
fct_+5,-495 -0.670 0.408 0.470 0.500 0.500
ag_grpt:_-5,+495 0.408 -0.670 -0.286 -0.608 -0.304 -0.304
ag_grpd:_-5,+495 0.470 -0.286 -0.670 -0.701 -0.350 -0.350
ag_grpt:_+10,-100 0.408 -0.670 -0.286 -0.304 -0.608 -0.304
ag_grpd:_+10,-100 0.470 -0.286 -0.670 -0.350 -0.701 -0.350
ag_grpt:_+5,-495 0.408 -0.670 -0.286 -0.304 -0.304 -0.608
ag_grpd:_+5,-495 0.470 -0.286 -0.670 -0.350 -0.350 -0.701
ag_grpt:_-5,+495 ag_grpd:_-5,+495 ag_grpt:_+10,-100
age_grouptn
age_gropdlt
fct_-5,+495
fc_+10,-100
fct_+5,-495
ag_grpt:_-5,+495
ag_grpd:_-5,+495 0.426
ag_grpt:_+10,-100 0.500 0.213
ag_grpd:_+10,-100 0.213 0.500 0.426
ag_grpt:_+5,-495 0.500 0.213 0.500
ag_grpd:_+5,-495 0.213 0.500 0.213
ag_grpd:_+10,-100 ag_grpt:_+5,-495
age_grouptn
age_gropdlt
fct_-5,+495
fc_+10,-100
fct_+5,-495
ag_grpt:_-5,+495
ag_grpd:_-5,+495
ag_grpt:_+10,-100
ag_grpd:_+10,-100
ag_grpt:_+5,-495 0.213
ag_grpd:_+5,-495 0.500 0.426
This is not surprising given what the number of points earned already showed. But now that we are looking at a behavioral measure instead of an outcome measure we might be able to quantify constructs of interest like sensitivity to variance or sensitivity to the expected values of the machines.
As a first step to translate raw playing behavior to learning I recoded the choices to be correct when a subject chooses to play a positive expected value machine and pass a negative expected value machine and incorrect when the reverse is true. If a subject is learning they should be learning to play the positive expected machines and to pass the others.
Recoding the behavior in this way gave a clearer picture of the age difference in learning of optimal behavior between the conditions. Specifically we can now look at how the probability of a correct choice changes for each age group in each condition across trials.
machine_game_data_clean %>%
group_by(Sub_id, facet_labels) %>%
mutate(rel_tm = 1:n()) %>%
# ggplot(aes(scale(Trial_number), correct1_incorrect0))+
ggplot(aes(rel_tm, correct1_incorrect0))+
geom_line(aes(group = Sub_id, col= factor(age_group, levels=c('kid', 'teen', 'adult'))),stat='smooth', method = 'glm', method.args = list(family = "binomial"), se = FALSE, alpha=0.2)+
geom_line(aes(col= factor(age_group, levels=c('kid', 'teen', 'adult'))),stat='smooth', method = 'glm', method.args = list(family = "binomial"), se = FALSE, alpha=1, size=2)+
facet_wrap(~facet_labels)+
theme_bw()+
# xlab("Relative trial number")+
xlab("Trial number")+
scale_y_continuous(breaks=c(0,1))+
labs(col="Age group")+
ylab('Correct choice')+
theme(legend.position = "bottom",
panel.grid = element_blank())
ggsave("Learning.jpeg", device = "jpeg", path = fig_path, width = 8, height = 5, units = "in", dpi = 450)
Effect of EV: Comparing positive EV to negative EV (the two rows) There is no real learning, significant change in behavior across time for the positive EV machines while there is for the negative EV machines.
Effect of variance: Comparing high var to low var (the two cols). Here there is an interaction: there is no effect of variance for the positive EV machines but there is an effect for the negative EV machines such that learning from high var is harder for kids for negative EV.
So the smaller the EV the more learning on average (for all age groups) unless the outcomes are too variable, in which case kids don’t learn from negative EV either
Looking at learning effects separately for each machine to avoid interpreting messy three-way interactions.
Adults are more likely to make correct decisions in low var positive EV machine.
summary(glmer(correct1_incorrect0 ~ age_group*scale(Trial_number)+(1|Sub_id), data = machine_game_data_clean %>% filter(facet_labels %in% c('-10,+100')), family=binomial))
Generalized linear mixed model fit by maximum likelihood (Laplace
Approximation) [glmerMod]
Family: binomial ( logit )
Formula: correct1_incorrect0 ~ age_group * scale(Trial_number) + (1 |
Sub_id)
Data:
machine_game_data_clean %>% filter(facet_labels %in% c("-10,+100"))
AIC BIC logLik deviance df.resid
2765.2 2808.0 -1375.6 2751.2 3323
Scaled residuals:
Min 1Q Median 3Q Max
-6.2463 0.1222 0.2114 0.4679 1.9208
Random effects:
Groups Name Variance Std.Dev.
Sub_id (Intercept) 2.495 1.58
Number of obs: 3330, groups: Sub_id, 74
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.439718 0.307086 4.688 2.75e-06
age_groupteen 0.867289 0.513973 1.687 0.0915
age_groupadult 1.125890 0.450255 2.501 0.0124
scale(Trial_number) 0.007483 0.069007 0.108 0.9136
age_groupteen:scale(Trial_number) -0.015519 0.126326 -0.123 0.9022
age_groupadult:scale(Trial_number) 0.122810 0.112620 1.090 0.2755
(Intercept) ***
age_groupteen .
age_groupadult *
scale(Trial_number)
age_groupteen:scale(Trial_number)
age_groupadult:scale(Trial_number)
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Correlation of Fixed Effects:
(Intr) ag_grpt ag_grpd sc(T_) ag_grpt:(T_)
age_grouptn -0.591
age_gropdlt -0.672 0.409
scl(Trl_nm) 0.001 0.000 0.000
ag_grpt:(T_) 0.000 -0.001 0.000 -0.546
ag_grpd:(T_) 0.000 0.001 0.014 -0.613 0.335
The probability of making a correct response for the high var positive EV machine doesn’t change for adults or kids but increases for teens across trials.
summary(glmer(correct1_incorrect0 ~ age_group*scale(Trial_number)+(1|Sub_id), data = machine_game_data_clean %>% filter(facet_labels %in% c('-5,+495')), family=binomial))
Generalized linear mixed model fit by maximum likelihood (Laplace
Approximation) [glmerMod]
Family: binomial ( logit )
Formula: correct1_incorrect0 ~ age_group * scale(Trial_number) + (1 |
Sub_id)
Data:
machine_game_data_clean %>% filter(facet_labels %in% c("-5,+495"))
AIC BIC logLik deviance df.resid
3541.7 3584.4 -1763.8 3527.7 3323
Scaled residuals:
Min 1Q Median 3Q Max
-4.5099 -0.7129 0.2903 0.5743 3.5970
Random effects:
Groups Name Variance Std.Dev.
Sub_id (Intercept) 2.234 1.494
Number of obs: 3330, groups: Sub_id, 74
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 0.42654 0.28650 1.489 0.137
age_groupteen 0.53545 0.47253 1.133 0.257
age_groupadult 0.54340 0.41176 1.320 0.187
scale(Trial_number) 0.02284 0.06365 0.359 0.720
age_groupteen:scale(Trial_number) 0.25735 0.10973 2.345 0.019 *
age_groupadult:scale(Trial_number) 0.02660 0.09651 0.276 0.783
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Correlation of Fixed Effects:
(Intr) ag_grpt ag_grpd sc(T_) ag_grpt:(T_)
age_grouptn -0.606
age_gropdlt -0.695 0.422
scl(Trl_nm) 0.001 0.000 0.000
ag_grpt:(T_) 0.000 0.013 0.001 -0.580
ag_grpd:(T_) 0.000 0.000 0.002 -0.660 0.383
All groups show improvement across trials for the low var negative EV machine but adults learn faster than kids and teens.
summary(glmer(correct1_incorrect0 ~ age_group*scale(Trial_number)+(1|Sub_id), data = machine_game_data_clean %>% filter(facet_labels %in% c('+10,-100')), family=binomial))
Generalized linear mixed model fit by maximum likelihood (Laplace
Approximation) [glmerMod]
Family: binomial ( logit )
Formula: correct1_incorrect0 ~ age_group * scale(Trial_number) + (1 |
Sub_id)
Data:
machine_game_data_clean %>% filter(facet_labels %in% c("+10,-100"))
AIC BIC logLik deviance df.resid
3950.7 3993.5 -1968.4 3936.7 3323
Scaled residuals:
Min 1Q Median 3Q Max
-4.1909 -0.8578 0.3636 0.7398 3.7967
Random effects:
Groups Name Variance Std.Dev.
Sub_id (Intercept) 1.066 1.033
Number of obs: 3330, groups: Sub_id, 74
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.13317 0.20284 -0.656 0.511504
age_groupteen 0.47515 0.33264 1.428 0.153175
age_groupadult 1.00168 0.29041 3.449 0.000562
scale(Trial_number) 0.30176 0.06299 4.791 1.66e-06
age_groupteen:scale(Trial_number) -0.01954 0.10145 -0.193 0.847237
age_groupadult:scale(Trial_number) 0.33421 0.09422 3.547 0.000390
(Intercept)
age_groupteen
age_groupadult ***
scale(Trial_number) ***
age_groupteen:scale(Trial_number)
age_groupadult:scale(Trial_number) ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Correlation of Fixed Effects:
(Intr) ag_grpt ag_grpd sc(T_) ag_grpt:(T_)
age_grouptn -0.610
age_gropdlt -0.699 0.427
scl(Trl_nm) -0.003 0.002 0.003
ag_grpt:(T_) 0.001 0.005 -0.001 -0.620
ag_grpd:(T_) 0.000 0.000 0.033 -0.667 0.414
Kids don’t show learning across trials for the high var negative EV machine but adults and teens do.
summary(glmer(correct1_incorrect0 ~ age_group*scale(Trial_number)+(1|Sub_id), data = machine_game_data_clean%>% filter(facet_labels %in% c('+5,-495')), family=binomial))
Generalized linear mixed model fit by maximum likelihood (Laplace
Approximation) [glmerMod]
Family: binomial ( logit )
Formula: correct1_incorrect0 ~ age_group * scale(Trial_number) + (1 |
Sub_id)
Data:
machine_game_data_clean %>% filter(facet_labels %in% c("+5,-495"))
AIC BIC logLik deviance df.resid
3805.8 3848.6 -1895.9 3791.8 3323
Scaled residuals:
Min 1Q Median 3Q Max
-2.5476 -0.6770 -0.3721 0.7510 3.1894
Random effects:
Groups Name Variance Std.Dev.
Sub_id (Intercept) 1.222 1.105
Number of obs: 3330, groups: Sub_id, 74
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.92954 0.21726 -4.278 1.88e-05
age_groupteen 0.38305 0.35560 1.077 0.281394
age_groupadult 1.07377 0.30891 3.476 0.000509
scale(Trial_number) 0.02305 0.06463 0.357 0.721311
age_groupteen:scale(Trial_number) 0.39636 0.10578 3.747 0.000179
age_groupadult:scale(Trial_number) 0.69180 0.09630 7.184 6.79e-13
(Intercept) ***
age_groupteen
age_groupadult ***
scale(Trial_number)
age_groupteen:scale(Trial_number) ***
age_groupadult:scale(Trial_number) ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Correlation of Fixed Effects:
(Intr) ag_grpt ag_grpd sc(T_) ag_grpt:(T_)
age_grouptn -0.611
age_gropdlt -0.703 0.429
scl(Trl_nm) -0.002 0.001 0.002
ag_grpt:(T_) 0.000 -0.015 0.000 -0.611
ag_grpd:(T_) -0.001 0.000 0.011 -0.671 0.412
I tried to capture these effects in ‘individual difference’ variables by running the logistic regression separately for each subject in each condition. This wouldn’t capture anything different than the above analyses but I wanted to see if there were any subject-specific indices that could be correlated with other measues. I looked at three parameters:
Because each model is run only on 45 trials the fits aren’t great and the parameter distributions have large variances.
get_learning_coef <- function(data){
model = glm(correct1_incorrect0 ~ scale(Trial_number), family = binomial(link=logit), data = data)
b0 = coef(model)[1]
b1 = coef(model)[2]
learnIndex = -b0/b1
return(data.frame(b0, b1, learnIndex))
}
tmp = machine_game_data_clean %>%
group_by(Sub_id, facet_labels) %>%
do(get_learning_coef(.)) %>%
do(assign.age.info(.))
(Error bars not shown because they are very large due to bad fits).
As expected the difference between kids and adults in slopes for the high variance negative EV machine is visible here too.
tmp %>%
ungroup()%>%
select(facet_labels, age_group, b0, b1, learnIndex) %>%
gather(key, value, -facet_labels, -age_group) %>%
group_by(age_group, facet_labels, key) %>%
summarise(mv = median(value),
sv = sem(value)) %>%
ggplot(aes(facet_labels, mv, fill=age_group))+
geom_bar(stat="identity", position = position_dodge())+
# geom_errorbar(aes(ymin = mv-sv, ymax = mv+sv), position = position_dodge(width = 0.9), width=0)+
facet_wrap(~key, scale="free")+
theme(legend.position = "bottom",
legend.title = element_blank())+
xlab("")+
ylab("Median value")
But it’s not a good idea to look for group differences in these parameters as they are highly variable due to bad fits from few trials.
Does it makes sense to look at these separately?
Since the machines differ in the variance of the outcomes and expected values it might seem sensible to look at which of these attributes has a larger effect on performance.
It’s tempting to tease apart the relative importance of these attributes for the high variance negative EV machine where we observe the performance difference between age groups.
BUT these attributes are correlated. So we can’t look at their effects separately in the same model.
#Function to calculate observed variance and observed expected value based on outcomes in trials that the subject has played.
get_obs_var_ev <- function(data){
new_data = data
new_data$obs_var <- NA
new_data$obs_ev <- NA
for(i in 1:nrow(new_data)){
if(i == 1){
obs = 0
obs_ev = 0
obs_var = 0
}
else{
#get all the trials until the current trial
obs = new_data[1:i,]
#filter only played trials; their belief should not be updated based on the trials they haven't played
obs = obs %>% filter(Response == "play") %>% ungroup() %>% select(Points_earned)
obs_var = var(obs)
obs_probs = as.numeric(prop.table(table(obs)))
obs_rewards = as.numeric(names(prop.table(table(obs))))
obs_ev = sum(obs_probs*obs_rewards)
}
new_data$obs_var[i] = obs_var
new_data$obs_ev[i] = obs_ev
}
new_data$obs_var = ifelse(is.na(new_data$obs_var), 0, new_data$obs_var)
return(new_data)
}
tmp = machine_game_data_clean %>%
group_by(Sub_id, facet_labels) %>%
do(get_obs_var_ev(.))
tmp %>%
ggplot(aes(obs_var, obs_ev))+
geom_point()+
facet_wrap(~facet_labels, scales="free")+
xlab("Observed variance")+
ylab("Observed EV")
What we are interested in is the effect of beliefs about the machines on behavior. These beliefs can be summarized quantitatively in an ‘expected value.’
The cognitive processes that can differ with respect to this expected value can be how quickly it approaches the true expected value of a machine (the rate at which one incorporates each new data point to existing beliefs) and how truthfully the expected values are evaluated (is the utility of the expected value the same as its value).
These two processes can be captured as the learning rate and the exponent on the prediction error in an RL model.
Before moving on to modeling results here I plot the effect of observed EV (not model based) on choice to confirm that it makes sense and captures the behavioral effect:
The higher the EV of a machine the more likely it is to be played. This is the correct action for the positive EV machines but incorrect action for the negative EV machines. The behavioral effect in the high var negative EV machine is captured again with the diverging lines for age groups at low EVs.
tmp %>%
ggplot(aes(obs_ev, correct1_incorrect0))+
geom_line(aes(group = Sub_id, col= age_group),stat='smooth', method = 'glm', method.args = list(family = "binomial"), se = FALSE, alpha=0.2)+
geom_line(aes(col= age_group),stat='smooth', method = 'glm', method.args = list(family = "binomial"), se = FALSE, alpha=1, size=2)+
facet_wrap(~facet_labels, scales='free')+
xlab("EV of played trials")+
scale_y_continuous(breaks=c(0,1))+
labs(col="Age group")+
ylab('Correct')+
theme(legend.position = "bottom",
legend.title = element_blank())
Though I focus on learning behavior and specifically difference in learning for the high variance negative EV machine there are other possible behavioral patterns that might also differ between the age groups. Here I list some examples.
Do people ‘explore’ the first 10 trials where the reward probabilities for each machine are presented?
They explore less when they encounter a loss early on. In the high var pos EV machine they get 4 (small) losses in a row; in the low var negative EV machine they get a moderate loss in the first trial.
machine_game_data_clean %>%
group_by(Sub_id, facet_labels) %>%
slice(1:10) %>%
summarise(num_explored = sum(ifelse(Response == "play", 1,0))) %>%
do(assign.age.info(.)) %>%
ungroup() %>%
group_by(age_group, facet_labels) %>%
summarise(mean_num_explored = mean(num_explored/10*100),
sem_num_explored = sem(num_explored/10*100)) %>%
ggplot(aes(facet_labels, mean_num_explored, fill = age_group))+
geom_bar(stat="identity",position = position_dodge(0.9))+
geom_errorbar(aes(ymax = mean_num_explored+sem_num_explored, ymin = mean_num_explored-sem_num_explored), position = position_dodge(width = 0.9), width=0.25)+
theme(legend.title = element_blank())+
ylab("Percentage of exploration")+
xlab("")
How does performance change depending on the delay between the last time a machine was played?
Can we think of this as a ‘memory effect’? The more trials since the last time you have played a machine, the more forgetting/interference?
For positive EV machines this is true for all groups. This is evident in the decreasing probability of a correct response the longer it has been since the last time a machine was played.
For negative EV machines adults and teens continue to make correct choices even if a lot of trials have passed since they last played that machine. Kids don’t seem to remember that the machine is ‘bad’ and are more likely to make an incorrect choice (and play the machine) the longer it’s been since they last played it.
machine_game_data_clean %>%
group_by(Sub_id) %>%
mutate(played_trial_number = ifelse(Response == "play", Trial_number, NA)) %>%
mutate(played_trial_number = na.locf(played_trial_number, na.rm=F)) %>%
filter(Trial_number > 1) %>%
mutate(trials_since_last_played = Trial_number - lag(played_trial_number)) %>%
ggplot(aes(trials_since_last_played, correct1_incorrect0, col = age_group))+
geom_line(stat='smooth', method = 'glm', method.args = list(family = "binomial"), alpha=1, size=2)+
facet_wrap(~facet_labels)+
theme(legend.title = element_blank())+
xlab("Trials since last played")+
ylab("Correct")+
scale_y_continuous(breaks=c(0,1))
If subjects are sensitive to losses and learning something about the machines in a way that overweights their most recent experience with the machine one sanity check is to compare how many trials it takes subjects to play a machine again after a loss versus a gain. Presumably the former would be higher than the latter. One might hesitate to play a machine again after a loss but be more likely to play it after a gain.
count.postoutcome.trials <- function(subject_data){
loss_trials = which(subject_data$Points_earned<0)
gain_trials = which(subject_data$Points_earned>0)
play_trials= which(subject_data$Response == "play")
post_loss_trials = play_trials[which(play_trials %in% loss_trials)+1]
post_gain_trials = play_trials[which(play_trials %in% gain_trials)+1]
num_trials_post_loss = post_loss_trials - loss_trials
num_trials_post_gain = post_gain_trials - gain_trials
if(length(num_trials_post_gain)>length(num_trials_post_loss)){
num_trials_post_loss <- c(num_trials_post_loss, rep(NA, length(num_trials_post_gain) - length(num_trials_post_loss)))
}
else if(length(num_trials_post_gain)<length(num_trials_post_loss)){
num_trials_post_gain <- c(num_trials_post_gain, rep(NA, length(num_trials_post_loss) - length(num_trials_post_gain)))
}
return(data.frame(num_trials_post_loss = num_trials_post_loss, num_trials_post_gain = num_trials_post_gain))
}
The plot below shows the average number of trials it takes a subject to play a given machine after experiencing a loss or a gain.
For everyone and for every machine the average number of trials it takes a subject to play following a loss is higher than the average number of trials it take them to play following a gain. This suggests that subjects are responding to outcomes in a way overweights their most recent experience with the machine.
tmp = machine_game_data_clean %>%
group_by(Sub_id, facet_labels) %>%
do(count.postoutcome.trials(.)) %>%
do(assign.age.info(.)) %>%
ungroup() %>%
select(facet_labels, age_group, num_trials_post_loss, num_trials_post_gain, Sub_id) %>%
gather(key, value, -facet_labels, -age_group, -Sub_id) %>%
mutate(key = gsub("num_trials_post_", "", key))
tmp %>%
group_by(facet_labels, age_group, key) %>%
summarise(mean_post = mean(value, na.rm=T),
sem_post = sem(value)) %>%
ggplot(aes(age_group, mean_post, shape=key, col=age_group))+
geom_point(size=2)+
geom_errorbar(aes(ymin = mean_post-sem_post, ymax = mean_post+sem_post), width=0)+
facet_wrap(~facet_labels)+
ylab("Number of trials until next play")+
xlab("")+
theme(legend.title = element_blank())+
guides(color=FALSE)
Reflecting the global behavior in proportion of playing in each condition adults take longer to play after large losses in the high variance negative EV condition compared to kids while kids are less sensitive to the magnitude of loss.
summary(lm(value~age_group*facet_labels,tmp %>%filter(key=="loss")))
Call:
lm(formula = value ~ age_group * facet_labels, data = tmp %>%
filter(key == "loss"))
Residuals:
Min 1Q Median 3Q Max
-1.8387 -0.4617 -0.4160 -0.2342 26.8007
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.41929 0.07401 19.177 < 2e-16
age_groupteen -0.18511 0.11724 -1.579 0.114438
age_groupadult -0.14424 0.10301 -1.400 0.161503
facet_labels-5,+495 0.25664 0.09751 2.632 0.008527
facet_labels+10,-100 0.78004 0.11960 6.522 7.81e-11
facet_labels+5,-495 0.56908 0.18936 3.005 0.002670
age_groupteen:facet_labels-5,+495 -0.02910 0.15382 -0.189 0.849940
age_groupadult:facet_labels-5,+495 -0.11572 0.13528 -0.855 0.392376
age_groupteen:facet_labels+10,-100 0.35057 0.19749 1.775 0.075961
age_groupadult:facet_labels+10,-100 0.78089 0.18237 4.282 1.90e-05
age_groupteen:facet_labels+5,-495 0.40507 0.31393 1.290 0.197020
age_groupadult:facet_labels+5,-495 0.99458 0.28832 3.450 0.000567
(Intercept) ***
age_groupteen
age_groupadult
facet_labels-5,+495 **
facet_labels+10,-100 ***
facet_labels+5,-495 **
age_groupteen:facet_labels-5,+495
age_groupadult:facet_labels-5,+495
age_groupteen:facet_labels+10,-100 .
age_groupadult:facet_labels+10,-100 ***
age_groupteen:facet_labels+5,-495
age_groupadult:facet_labels+5,-495 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.616 on 3936 degrees of freedom
(1653 observations deleted due to missingness)
Multiple R-squared: 0.06843, Adjusted R-squared: 0.06582
F-statistic: 26.28 on 11 and 3936 DF, p-value: < 2.2e-16
What affects whether a subject plays after experiencing a loss? The magnitude of the loss they expired? How long they think before playing?
First look at how this changes across the task: Subject are more likely to be make the correct choice for the negative EV machines as the task goes by.
machine_game_data_clean %>%
mutate(losstrial = ifelse(Points_earned<0,1,0),
postloss = lag(losstrial),
postloss_play1_pass0 = ifelse(postloss == 1 & Response == "play",1, ifelse(postloss==1 & Response == "pass", 0, NA))) %>%
group_by(Sub_id, facet_labels) %>%
mutate(rel_trial = 1:n()) %>%
# ggplot(aes(rel_trial, postloss_play1_pass0))+
ggplot(aes(rel_trial, correct1_incorrect0))+
geom_smooth(aes(col=age_group), method='glm', method.args = list(family = "binomial"))+
facet_wrap(~facet_labels)+
scale_y_continuous(breaks=c(0,1))+
theme(legend.title = element_blank())+
xlab("Trial number")+
ylab("Probability of correct following a loss")
tmp = machine_game_data_clean %>%
mutate(losstrial = ifelse(Points_earned<0,1,0),
postloss = lag(losstrial),
postloss_play1_pass0 = ifelse(postloss == 1 & Response == "play",1, ifelse(postloss==1 & Response == "pass", 0, NA)),
lastlossamt = lag(Points_earned)) %>%
filter(postloss==1)
tmp %>%
ggplot(aes(Reaction_time, correct1_incorrect0))+
geom_smooth(aes(col=age_group), method='glm', method.args = list(family = "binomial"))+
facet_wrap(~facet_labels)+
scale_y_continuous(breaks=c(0,1))+
theme(legend.title = element_blank())+
xlab("RT")+
ylab("Probability of correct following a loss")
Baseline is -10,+100. Less likely to be correct in any of the machines after a loss compared to this baseline. Adults are more likely to be correct following a loss for all machines. There is also an effect of response time. The longer a decision takes the less likely it is to be correct. This is even stronger for adults (they are usually faster than kids but when they do take long they are even less likely to be correct).
If slower decisions are more likely to be incorrect would this suggest less of a drift process but more interference/uncertainty about knowledge on that machine instead?
summary(glmer(correct1_incorrect0 ~ facet_labels+scale(Reaction_time)*age_group+(1|Sub_id), tmp, family="binomial"))
Generalized linear mixed model fit by maximum likelihood (Laplace
Approximation) [glmerMod]
Family: binomial ( logit )
Formula:
correct1_incorrect0 ~ facet_labels + scale(Reaction_time) * age_group +
(1 | Sub_id)
Data: tmp
AIC BIC logLik deviance df.resid
4317.3 4380.4 -2148.7 4297.3 4058
Scaled residuals:
Min 1Q Median 3Q Max
-5.3908 -0.7149 0.3125 0.6121 4.9613
Random effects:
Groups Name Variance Std.Dev.
Sub_id (Intercept) 0.725 0.8514
Number of obs: 4068, groups: Sub_id, 74
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.47089 0.18790 7.828 4.95e-15
facet_labels-5,+495 -0.83557 0.11790 -7.087 1.37e-12
facet_labels+10,-100 -1.48368 0.11610 -12.779 < 2e-16
facet_labels+5,-495 -2.44639 0.12166 -20.109 < 2e-16
scale(Reaction_time) -0.30295 0.05896 -5.139 2.77e-07
age_groupteen 0.33118 0.27865 1.189 0.234622
age_groupadult 0.82255 0.24460 3.363 0.000772
scale(Reaction_time):age_groupteen 0.06909 0.10298 0.671 0.502308
scale(Reaction_time):age_groupadult -0.28319 0.09359 -3.026 0.002480
(Intercept) ***
facet_labels-5,+495 ***
facet_labels+10,-100 ***
facet_labels+5,-495 ***
scale(Reaction_time) ***
age_groupteen
age_groupadult ***
scale(Reaction_time):age_groupteen
scale(Reaction_time):age_groupadult **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Correlation of Fixed Effects:
(Intr) f_-5,+ f_+10, f_+5,- sc(R_) ag_grpt ag_grpd
fct_-5,+495 -0.373
fc_+10,-100 -0.373 0.616
fct_+5,-495 -0.360 0.598 0.621
scl(Rctn_t) -0.092 0.071 0.026 0.061
age_grouptn -0.543 -0.006 -0.018 -0.022 0.044
age_gropdlt -0.614 -0.011 -0.028 -0.045 0.049 0.424
scl(Rctn_tm):g_grpt 0.057 -0.032 -0.027 -0.061 -0.573 -0.026 -0.027
scl(Rctn_tm):g_grpd 0.057 -0.040 -0.032 -0.019 -0.628 -0.028 -0.056
scl(Rctn_tm):g_grpt
fct_-5,+495
fc_+10,-100
fct_+5,-495
scl(Rctn_t)
age_grouptn
age_gropdlt
scl(Rctn_tm):g_grpt
scl(Rctn_tm):g_grpd 0.360
If one knew which were positive and which negative EV machines one would either always play for positive EV machines or never play for negative EV machines regardless of the observed outcome. So for the positive EV machines there would be no difference between gains/losses and for the negative EV machines there will be no points to plot (because it will never be played). The difference in behavior depending on the valence of the recently observed outcome (gain/loss) could be due to at least two reasons: memory or loss aversion. Or perhaps stronger memories for losses for adults. Do kids play the bad machine because they can’t remember how bad that machine is or they don’t care to loose as much? Perhaps there is something interesting to look at in the hippocampal activity following losses versus gains.
Studies that compute loss aversion present subjects with gambles where the amounts and probabilities are known. This is not the case for our paradigm (which is what makes it a learning task) which is why I estimate them as part of RL models later too. For the sake of it let’s assume subjects knew the gain and loss amounts for each machine and calculate loss aversion:
We don’t find a difference in the estimates between adults and kids. Neither had Barkley-Levenson et al. (2014).
get_loss_aversion = function(data){
data = data %>%
filter(Response != "time-out") %>%
mutate(play1_pass0 = ifelse(Response=="pass", 0,1),
gain_mag = as.numeric(gain_mag),
loss_mag = as.numeric(loss_mag))
m = glm(play1_pass0 ~ gain_mag+loss_mag, data, family="binomial")
loss_ave = -coef(m)[3]/coef(m)[2]
return(data.frame(loss_ave = loss_ave))
}
machine_game_data_clean %>%
group_by(Sub_id) %>%
do(get_loss_aversion(.)) %>%
do(assign.age.info(.)) %>%
ggplot(aes(log(loss_ave), fill=age_group))+
geom_density(alpha=0.4, color=NA)+
theme(legend.title = element_blank())
Are subjects less likely to play overall after a loss or only less likely to play that machine after a loss for that machine?
mean.postloss.play.prob <- function(subject_data){
loss_trials = which(subject_data$Points_earned<0)
mean_post_loss_prob <- mean(ifelse(subject_data$Response[loss_trials+1] == "play", 1, 0), na.rm=T)
return(data.frame(mean_post_loss_prob=mean_post_loss_prob))
}
Probability of playing following a loss depends on machine type. Looking at all trials masks this difference. Subjects seem to learn machine specifically and cross-talk isn’t evident here.
tmp = machine_game_data_clean %>%
group_by(Sub_id) %>%
do(mean.postloss.play.prob(.)) %>%
mutate(facet_labels = "all_trials")
machine_game_data_clean %>%
group_by(Sub_id, facet_labels) %>%
do(mean.postloss.play.prob(.)) %>%
rbind(tmp) %>%
do(assign.age.info(.)) %>%
group_by(age_group, facet_labels) %>%
summarise(mp = mean(mean_post_loss_prob,na.rm=T),
sp = sem(mean_post_loss_prob)) %>%
ggplot(aes(facet_labels, mp, fill=age_group))+
geom_bar(stat="identity",position=position_dodge())+
geom_errorbar(width=0, aes(ymin = mp-sp, ymax = mp+sp), position = position_dodge(width=0.9))+
xlab("")+
ylab("Post loss play probability")+
theme(legend.title = element_blank())
machine_game_data_clean %>%
ggplot(aes(log(Reaction_time))) +
geom_density(aes(fill = age_group), alpha=0.5, color=NA) +
facet_wrap(~facet_labels)+
theme(legend.title = element_blank())+
ylab("")+
xlab("Log Response Time")
machine_game_data_clean %>%
group_by(Sub_id, facet_labels) %>%
summarise(mean_log_rt = mean(log(Reaction_time)),
sem_log_rt = sem(log(Reaction_time))) %>%
do(assign.age.info(.)) %>%
ggplot(aes(age_group, mean_log_rt))+
geom_boxplot(aes(fill=age_group))+
facet_wrap(~facet_labels)+
theme(legend.position = "none")+
ylab("Mean Log Rt")+
xlab("Age group")
Both teens and adults are faster than kids in all conditions but the high var negative EV.
#summary(lmer(log(Reaction_time) ~ age_group*facet_labels +(1|Sub_id), data = machine_game_data_clean))
summary(lmer(log(Reaction_time) ~ age_group +(1|Sub_id), data = machine_game_data_clean%>%filter(facet_labels == "-10,+100")))
Linear mixed model fit by REML ['lmerMod']
Formula: log(Reaction_time) ~ age_group + (1 | Sub_id)
Data: machine_game_data_clean %>% filter(facet_labels == "-10,+100")
REML criterion at convergence: 3467.5
Scaled residuals:
Min 1Q Median 3Q Max
-3.5493 -0.6537 -0.1098 0.5737 3.9100
Random effects:
Groups Name Variance Std.Dev.
Sub_id (Intercept) 0.03498 0.1870
Residual 0.15674 0.3959
Number of obs: 3330, groups: Sub_id, 74
Fixed effects:
Estimate Std. Error t value
(Intercept) 6.99491 0.03642 192.072
age_groupteen -0.20684 0.05991 -3.453
age_groupadult -0.22138 0.05196 -4.260
Correlation of Fixed Effects:
(Intr) ag_grpt
age_grouptn -0.608
age_gropdlt -0.701 0.426
summary(lmer(log(Reaction_time) ~ age_group +(1|Sub_id), data = machine_game_data_clean%>%filter(facet_labels == "-5,+495")))
Linear mixed model fit by REML ['lmerMod']
Formula: log(Reaction_time) ~ age_group + (1 | Sub_id)
Data: machine_game_data_clean %>% filter(facet_labels == "-5,+495")
REML criterion at convergence: 4024.7
Scaled residuals:
Min 1Q Median 3Q Max
-6.5631 -0.6513 -0.1148 0.6295 3.1253
Random effects:
Groups Name Variance Std.Dev.
Sub_id (Intercept) 0.0469 0.2166
Residual 0.1848 0.4299
Number of obs: 3330, groups: Sub_id, 74
Fixed effects:
Estimate Std. Error t value
(Intercept) 6.99842 0.04194 166.870
age_groupteen -0.14905 0.06899 -2.161
age_groupadult -0.13063 0.05984 -2.183
Correlation of Fixed Effects:
(Intr) ag_grpt
age_grouptn -0.608
age_gropdlt -0.701 0.426
summary(lmer(log(Reaction_time) ~ age_group +(1|Sub_id), data = machine_game_data_clean%>%filter(facet_labels == "+10,-100")))
Linear mixed model fit by REML ['lmerMod']
Formula: log(Reaction_time) ~ age_group + (1 | Sub_id)
Data: machine_game_data_clean %>% filter(facet_labels == "+10,-100")
REML criterion at convergence: 3767
Scaled residuals:
Min 1Q Median 3Q Max
-3.2565 -0.6809 -0.1059 0.6505 3.1132
Random effects:
Groups Name Variance Std.Dev.
Sub_id (Intercept) 0.02916 0.1708
Residual 0.17241 0.4152
Number of obs: 3330, groups: Sub_id, 74
Fixed effects:
Estimate Std. Error t value
(Intercept) 7.03189 0.03373 208.479
age_groupteen -0.12876 0.05548 -2.321
age_groupadult -0.12762 0.04812 -2.652
Correlation of Fixed Effects:
(Intr) ag_grpt
age_grouptn -0.608
age_gropdlt -0.701 0.426
summary(lmer(log(Reaction_time) ~ age_group +(1|Sub_id), data = machine_game_data_clean%>%filter(facet_labels == "+5,-495")))
Linear mixed model fit by REML ['lmerMod']
Formula: log(Reaction_time) ~ age_group + (1 | Sub_id)
Data: machine_game_data_clean %>% filter(facet_labels == "+5,-495")
REML criterion at convergence: 3803.6
Scaled residuals:
Min 1Q Median 3Q Max
-6.0339 -0.6841 -0.0940 0.6244 3.9074
Random effects:
Groups Name Variance Std.Dev.
Sub_id (Intercept) 0.03425 0.1851
Residual 0.17381 0.4169
Number of obs: 3330, groups: Sub_id, 74
Fixed effects:
Estimate Std. Error t value
(Intercept) 6.98863 0.03625 192.779
age_groupteen -0.08277 0.05963 -1.388
age_groupadult -0.09490 0.05172 -1.835
Correlation of Fixed Effects:
(Intr) ag_grpt
age_grouptn -0.608
age_gropdlt -0.701 0.426
How would you group learners vs. non-learners? Those who are more likely to make correct choices later in the task - so positive slope for the sigmoid?
tmp = machine_game_data_clean %>%
group_by(Sub_id, facet_labels) %>%
do(get_learning_coef(.)) %>%
do(assign.age.info(.)) %>%
mutate(learner = ifelse(b1>0,1,0))
with(tmp, table(learner, facet_labels, age_group))
, , age_group = kid
facet_labels
learner -10,+100 -5,+495 +10,-100 +5,-495
0 14 14 12 18
1 15 15 17 11
, , age_group = teen
facet_labels
learner -10,+100 -5,+495 +10,-100 +5,-495
0 10 4 5 6
1 7 13 12 11
, , age_group = adult
facet_labels
learner -10,+100 -5,+495 +10,-100 +5,-495
0 13 11 4 7
1 15 17 24 21
non_learners = tmp %>%
filter(facet_labels %in% c("+5,-495", "+10,-100")) %>%
filter(learner == 0)
non_learners = unique(non_learners$Sub_id)
non_learners
[1] 100003 100009 100042 100051 100057 100059 100063 100068 100105 100109
[11] 100129 100143 100169 100180 100185 100188 100207 100241 100243 100244
[21] 100250 200056 200085 200133 200162 200164 200168 200199 200211 306587
[31] 311047 311283 311444 311479 400742 407260 408394 411477
Or trials post-learning? [probably for imaging]
Details of model comparison can be found in a separate notebook.